<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
</head>
<body>
    <div id="app">
        <input type="text" v-model="firstName">
        <input type="text" v-model="lastName">
        <div>{{fullName}}</div>
    </div>
</body>
<script>
    const {createApp, ref, reactive, watch} = Vue

    const firstName = ref('')
    const lastName = ref('')
    const fullName = ref('')

    const app = {

        setup() {
            watch(firstName, (newVal, oldVal) => {
                fullName.value = firstName.value + lastName.value
            })

            watch(lastName, (newVal, oldVal) => {
                fullName.value = firstName.value + lastName.value
            })

            return {
                firstName,
                lastName,
                fullName,
            }
        }
    }

    createApp(app).mount('#app')
</script>
</html>